#define DEBUG
#include <cstdio>
#define INF 0x7fffffff
#define MAXN 50
#define MAXM 50

using namespace std;

void initF(int n, int m, int map[MAXN+1][MAXM+1], int f[MAXN+2][MAXM+2][4]) {
  for (int i=1; i<=n; i++) {
    for (int j=1; j<=m; j++) {
      if (map[i][j]==0) {
	f[i][j][0]=f[i-1][j][0]+1;
	f[i][j][2]=f[i][j-1][2]+1;
      } else if (map[i][j]==1) {
	f[i][j][0]=f[i-1][j][0];
	f[i][j][2]=f[i][j-1][2];
      } else {
	f[i][j][0]=f[i][j][2]=0;
      }
    }
  }

  for (int i=n; i>0; i--) {
    for (int j=m; j>0; j--) {
      if (map[i][j]==0) {
	f[i][j][1]=f[i+1][j][1]+1;
	f[i][j][3]=f[i][j+1][3]+1;
      } else if (map[i][j]==1) {
	f[i][j][1]=f[i+1][j][1];
	f[i][j][3]=f[i][j+1][3];
      } else {
	f[i][j][1]=f[i][j][3]=0;
      }
    }
  }
}

void boom(int x, int y, int n, int m, int map[MAXN+1][MAXM+1]) {
  for (int i=x; i>0; i--) {
    if (map[i][y]==2) {
      break;
    }
    map[i][y]=1;
  }
  for (int i=x; i<=n; i++) {
    if (map[i][y]==2) {
      break;
    }
    map[i][y]=1;
  }

  for (int i=y; i>0; i--) {
    if (map[x][i]==2) {
      break;
    }
    map[x][i]=1;
  }
  for (int i=y; i<=m; i++) {
    if (map[x][i]==2) {
      break;
    }
    map[x][i]=1;
  }
}

int main() {
#ifdef DEBUG
  freopen("0.in", "r", stdin);
  freopen("0.out", "w", stdout);
#endif

  static int map[MAXN+1][MAXM+1], f[MAXN+2][MAXM+2][4];
  int n, m, tot=0;
  scanf("%d %d", &n, &m);
  for (int i=1; i<=n; i++) {
    for (int j=1; j<=m; j++) {
      char c;
      scanf(" %c ", &c);
      map[i][j] = c=='*' ? 0 : (c=='x' ? 1 : 2);
      tot += !map[i][j];
    }
  }

  int ans=0;
  for (; tot; ans++) {
    initF(n, m, map, f);
    int minsum=INF, minx=0, miny=0;
    for (int i=1; i<=n; i++) {
      for (int j=1; j<=m; j++) {
	if (!map[i][j] && minsum>f[i][j][0]+f[i][j][1]+f[i][j][2]+f[i][j][3]-3) {
	  minsum=f[i][j][0]+f[i][j][1]+f[i][j][2]+f[i][j][3]-3;
	  minx=i, miny=j;
	}
      }
    }
    
    tot-=minsum;
    boom(minx, miny, n, m, map);
  }

  printf("%d", ans);

  fclose(stdin);
  fclose(stdout);
  return 0;
}
